package com.gin.fanbox.param;

import com.gin.fanbox.utils.QsUtils;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.LinkedHashMap;

/**
 * @author bx002
 * @since 2024/2/5 17:51
 */
@Getter
@Setter
@NoArgsConstructor
public class PostListHomeParam {
    String maxPublishedDatetime;
    Long maxId;
    int limit = 10;

    public PostListHomeParam(String nextUrl) {
        final LinkedHashMap<String, String> parameterMap = QsUtils.parseParameterMap(nextUrl);
        this.limit = Integer.parseInt(parameterMap.get("limit"));
        this.maxId = Long.valueOf(parameterMap.get("maxId"));
        this.maxPublishedDatetime = parameterMap.get("maxPublishedDatetime");
    }
}
